package personal.learn.langchao;

import java.util.Scanner;

/**
 * 连续的树
 *
 * @author Chai yansheng
 * @create 2019/8/31
 **/
public class DaShu {
    private static class MyNode{
        public int value;
        public MyNode next;

        public MyNode(int value) {
            this.value = value;
        }
    }
    private static class MaxList{
        public int index;
        public int max;

        public MaxList(int index, int max) {
            this.index = index;
            this.max = max;
        }
    }
    public static void insertNode(MyNode root, int n) {
        MyNode curr = root ;
        MyNode pre = root;
        while (curr != null && curr.value < n) {
            pre = curr;
            curr = curr.next;
        }
        MyNode node = new MyNode(n);
        pre.next = node;
        node.next = curr;
    }
    public static MaxList findMax(MyNode root) {
        MaxList maxList = new MaxList(0, -1);
        MyNode pre = root;
        MyNode curr = root.next;
        while (curr != null && ((curr.value - pre.value - 2) / 2 > maxList.max)) {
            maxList.index = pre.value + 2;
            maxList.max = (curr.value - pre.value - 2) / 2;
            pre = curr;
            curr = curr.next;
        }
        return maxList;
    }
    public static void printList(MyNode root) {
        MyNode curr = root;
        while (curr != null) {
            System.out.println(curr.value);
            curr = curr.next;
        }
    }
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n;
        n = in.nextInt();
        MyNode qi = new MyNode(-1);
        MyNode qiLast = new MyNode(101);
        qiLast.next = null;
        qi.next = qiLast;
        MyNode ou = new MyNode(0);
        MyNode ouLast = new MyNode(102);
        ouLast.next = null;
        ou.next = ouLast;
        for (int i = 0; i < n; i++) {
            int num = in.nextInt();
            if (num % 2 ==1) {
                insertNode(qi, num);
            } else {
                insertNode(ou, num);
            }
        }
        /*printList(qi);
        System.out.println("============");
        printList(ou);*/
        MaxList qiMax = findMax(qi);
        MaxList ouMax = findMax(ou);
        if (qiMax.max >= ouMax.max) {
            System.out.println(qiMax.index + " " + qiMax.max);
        } else {
            System.out.println(ouMax.index + " " + ouMax.max);
        }
    }
}
